package com.netty.server;

import com.netty.server.server.ChatServer;
import com.netty.server.server.session.SessionManger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;


/**
 * @author 李醴茝
 */
@Configuration
@EnableAutoConfiguration
@ImportResource(locations = {"classpath:spring-redis.xml"})
@SpringBootApplication
public class ServerApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(ServerApplication.class, args);
        SessionManger sessionManger = context.getBean(SessionManger.class);
        SessionManger.setSingleInstance(sessionManger);
        ChatServer chatServer = context.getBean(ChatServer.class);
        chatServer.run();
    }

}
